n = int(input())
seats=input()
seats="0"+seats+"0"
if("11" in seats or "000" in seats):
print("NO")
else:
print("YES")
// Problem: A. Row
// Contest: Codeforces - Codeforces Round #484 (Div. 2)
// URL: https://codeforces.com/contest/982/problem/A
// Memory Limit: 256 MB
// Time Limit: 1000 ms
/*
#WTFyouhere
♕ABHINAV♕
HUSTLE KARO BHASAD NHI.....
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
const unsigned int M = 1000000007;
//►►►►►►►►►►►►►►►►►►►►(⊙⊙)(☉_☉)(⊙⊙)►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►
ll power(ll a, ll b, ll m = M) {a %= m;ll res = 1;while (b > 0) {
if (b & 1)res = res * a % m;a = a * a % m;b >>= 1;}return res;}
ll gcd(ll x, ll y) {return (x ? gcd(y % x, x) : y);}
ll inv(ll n, ll m = M) {return power(n, m - 2, m);}
ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
ll nextgreaterelement(ll n) {auto digits = to_string(n);
next_permutation(begin(digits), end(digits));auto res = stoll(digits);return res;}
vector<int> factorize(int n) {vector<int> ans;for (int i = 2; i * i <= n; ++i) {
while (n % i == 0) {ans.push_back(i);n /= i;}}if (n != 1) {ans.push_back(n);}
for(int i=0;i<ans.size();i++)cout<<ans[i]<<" ";}
ll near_pow(ll q){ll ans = (ll)log2(q);return pow(2,ans);}
long long ceil(long long p, long long q) {if(p % q == 0) return (p / q);return (p / q) + 1;}
//►►►►►►►►►►►►►►►►►►►(⊙⊙)(☉_☉)(⊙⊙)►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►►
void reply()
{
ll t;
cin>>t;
while(t--)
{
}
}
int main() {
// your code goes here
//reply();
int n;
cin>>n;
string s;
cin>>s;
int count=0;
if(n==1)
{
if(s[0]=='1')cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
else if((s[0]==s[1]&&s[0]=='0')||(s[n-1]==s[n-2]&&s[n-1]=='0'))cout<<"No"<<endl;
else
{
int cz=0,co=0;
for(int i=0;i<n;i++)
{
if(i+1<n)
{
if(s[i]==s[i+1]&& s[i]=='1')
{
co++;
break;
}
else if(s[i]==s[i+1] && s[i]=='0')
{
cz++;
if(cz+1==3)break;
}
else
{
co=0;
cz=0;
}
}
}
if(co>0)cout<<"No"<<endl;
else if(cz+1==3)cout<<"No"<<endl;
else cout<<"Yes"<<endl;
}
}
415. Add Strings | 22. Generate Parentheses |
13. Roman to Integer | 2. Add Two Numbers |
515. Find Largest Value in Each Tree Row | 345. Reverse Vowels of a String |
628. Maximum Product of Three Numbers | 1526A - Mean Inequality |
1526B - I Hate 1111 | 1881. Maximum Value after Insertion |
237. Delete Node in a Linked List | 27. Remove Element |
39. Combination Sum | 378. Kth Smallest Element in a Sorted Matrix |
162. Find Peak Element | 1529A - Eshag Loves Big Arrays |
19. Remove Nth Node From End of List | 925. Long Pressed Name |
1051. Height Checker | 695. Max Area of Island |
402. Remove K Digits | 97. Interleaving String |
543. Diameter of Binary Tree | 124. Binary Tree Maximum Path Sum |
1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | 501A - Contest |
160A- Twins | 752. Open the Lock |
1535A - Fair Playoff | 1538F - Interesting Function |